An arithmetic processing unit, such as a central processing unit (CPU) and the like, includes a decoding section that decodes an instruction, an arithmetic section that executes an arithmetic operation, based on the decoded instruction, and a cache memory provided between the arithmetic section and a main memory. The arithmetic section executes an arithmetic operation with reference to data stored in the main memory or the cache memory. The cache memory holds a part of data stored in the main memory.
The arithmetic processing unit refers to data stored in the cache memory that is provided in the same semiconductor device as that in which the arithmetic processing unit is provided, and which is operated by the same clock, and thus, a waiting time in referring to data may be reduced, as compared to when the arithmetic processing unit refers to data stored in the main memory. That is, the arithmetic processing unit executes prefetch in which reference target data stored in the main memory is fetched to the cache memory in advance, and thereby, a waiting time in referring data may be reduced.
As methods for realizing prefetch, prefetch (software prefetch) using a software and a prefetch (hardware prefetch) using a hardware are known. In software prefetch, in converting a source program to an object program that may be executed by the arithmetic processing unit, a compiler device that complies a program inserts a prefetch instruction for executing prefetch in the object program. Then, the arithmetic processing unit executes prefetch, based on the prefetch instruction.
On the other hand, in hardware prefetch, a hardware, such as a hardware prefetch mechanism and the like, is provided in the arithmetic processing unit. For example, if it is determined that a memory access an access destination of which regularly changes is executed, the hardware prefetch mechanism predicts data that is accessed next and fetches data stored in the main memory in advance. Japanese Laid-open Patent Publication No. 2003-223359, Japanese Laid-open Patent Publication No. 2011-150691, and Japanese Laid-open Patent Publication No. 2002-24007 discuss related art.